home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000109_icon-group-sender _Sat Apr 27 10:27:41 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
2KB
Received: by cheltenham.cs.arizona.edu; Sat, 27 Apr 1996 07:41:07 MST
Message-Id: <3181E88D.7DB5@tees.ac.uk>
Date: Sat, 27 Apr 1996 10:27:41 +0100
From: Hamish Lawson <H.Lawson@tees.ac.uk>
Organization: University of Teesside, School of Computing and Maths
X-Mailer: Mozilla 2.01Gold (Win95; I)
Mime-Version: 1.0
To: icon-group@cs.arizona.edu
Subject: Re: Splitting and joining strings
References: <199604172119.QAA18647@post.its.mcw.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
Thanks to everyone who responded to my post about splitting and joining
strings. I had hesitated about posting the question, suspecting that it would
be thought too trivial, but I was interested by how many different solutions
were offered to this 'trivial' problem :-). Bob Alexander provided the solution
which came closest to what I was after, which (with some modifications I've
made to the join procedure) I present below for anyone who's interested.
procedure join(stringList,separator)
local result
result := get(stringList)
every result ||:= separator || !stringList
return result
end
procedure split(string,separator)
local result
string ? {
until pos(0) do {
result := tab(find(separator) | 0)
suspend result
move(*separator)
}
}
end
| Hamish Lawson, School of Computing and Mathematics,
| University of Teesside, Middlesbrough, Cleveland, UK, TS1 3BA
| Tel: +44 1642 212695 Fax: +44 1642 342604
| E-mail: H.Lawson@tees.ac.uk